<template>
  <div class="my" :style="clieHeight">
    <div class="heade">
      <p class="wode">我的</p>
      <div class="heade_bot">
        <img src="../assets/头像.png" alt=""/>
        <div class="myInfo">
          <p>
            <span class="name">{{ user.loginName }}</span>
            <span class="my_position">{{ user.roleName }}</span>
          </p>
          <p class="password">{{ user.phone }}</p>
        </div>
      </div>
    </div>
    <div class="my_body">
      <div class="my_line">
        <van-cell class="my_line_cell" is-link @click="showPopup"
        >检查更新
        </van-cell
        >
        <van-popup v-model="show">当前已是最新版本</van-popup>
        <p class="lianxi">联系我们</p>
        <div class="telephone">
          <p class="tele_phone">400311565</p>
          <p class="my_addres">www.huiduowulian.com</p>
        </div>
      </div>
      <div class="my_botton">
        <button @click="myOut">退出登录</button>
      </div>
    </div>
    <tabbar :active="3"></tabbar>
  </div>
</template>
<script>
import {Dialog} from "vant";
import tabbar from "../comment/tabbar";

export default {
  data: () => ({
    show: false,
    user: [],
    clieHeight: "",
  }),
  created() {
    this.isLogin();
    this.getHeight();
  },
  methods: {
    showPopup() {
      this.show = !this.show;
    },
    isLogin() {
      if (JSON.parse(localStorage.getItem("users")) === null) {
        alert("请先登录");
      } else {
        this.user = JSON.parse(localStorage.getItem("users") || "[]");
      }
    },
    getHeight() {
      this.clieHeight = `height:${window.innerHeight}px`;
    },
    myOut() {
      Dialog.confirm({
        title: "",
        message: "确定退出",
      }).then(() => {
        localStorage.setItem("users", null);
        this.$router.push("/");
      });
    },
  },
  components: {
    tabbar,
  },
};
</script>
<style lang="less" scoped>
* {
  margin: 0;
  padding: 0;
}

.my {
  .heade {
    height: 124px;
    box-sizing: border-box;
    background-color: #f2f2f2;
    padding-top: 10px;

    .wode {
      text-align: center;
      color: black;
    }

    .heade_bot {
      img {
        width: 57px;
        height: 57px;
        border-radius: 50%;
        margin-right: 15px;
      }

      .name {
        color: #fff;
        font-size: 16px;
      }

      .password {
        font-size: 13px;
        color: #fff;
      }

      .my_position {
        display: inline-block;
        background-color: #ff5765;
        font-size: 12px;
        width: 80px;
        height: 23px;
        line-height: 23px;
        text-align: center;
        border-radius: 10px;
        margin-left: 10px;
        color: white;
      }

      padding: 20px;
      box-sizing: border-box;
      display: flex;
      margin-top: 10px;
      top: 20px;
      height: 201px;
      background-image: url("../assets/我的bg.png");
      background-size: 100%;

      p {
        margin-top: 5px;
      }
    }
  }

  .my_body {
    padding: 15px;
    box-sizing: border-box;
    padding-top: 40px;

    .my_line {
      // height: 131px;
      font-size: 14px;
      background-color: white;
      padding: 15px;
      box-sizing: border-box;
      border-radius: 15px;
      z-index: 100;

      .my_line_cell {
        height: 32px;
        font-size: 14px;
        color: #333;
        border-bottom: 1px solid #c5cfd6;
        // margin-bottom: 5px;
      }

      .lianxi {
        margin: 15px 0;
      }

      .my_line_cell::after {
        border: none;
      }

      .telephone {
        text-align: center;

        p {
          font-size: 14px;
        }

        .tele_phone {
          color: #0195ff;
        }

        .my_addres {
          margin-top: 10px;
          margin-bottom: 15px;
          color: #999;
        }
      }
    }
  }

  .my_botton {
    text-align: center;

    button {
      width: 210px;
      height: 40px;
      background-color: #0195ff;
      border: none;
      color: #fff;
      font-size: 15px;
      border-radius: 10px;
      margin-top: 24.9%;
    }
  }
}
</style>
